package cn.iocoder.yudao.module.exam.dal.mysql.exam;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.exam.dal.dataobject.exam.ExamDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.exam.controller.admin.exam.vo.*;

/**
 * 考试管理 Mapper
 *
 * @author Francis
 */
@Mapper
public interface ExamMapper extends BaseMapperX<ExamDO> {

    default PageResult<ExamDO> selectPage(ExamPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ExamDO>()
                .likeIfPresent(ExamDO::getExamName, reqVO.getExamName())
                .eqIfPresent(ExamDO::getGrade, reqVO.getGrade())
                .eqIfPresent(ExamDO::getSubject, reqVO.getSubject())
                .eqIfPresent(ExamDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ExamDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ExamDO::getId));
    }

}